/*
 * SongInfoPanel.java
 *
 * Created on September 19, 2005, 3:04 PM
 */
package com.bff.mpd.musicjukebox.ui;

import com.bff.bjj.ui.component.BJJPanel;
import org.bff.javampd.objects.MPDSong;

/**
 *
 * @author  Bill
 */
public class SongRetractInfoPanel
        extends BJJPanel {

    public SongRetractInfoPanel() {
        this(null);
    }

    public SongRetractInfoPanel(MPDSong song) {
        initComponents();
        if (song != null) {
            setInfo(song.getTitle());
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        jPanel1 = new javax.swing.JPanel();
        lblMsgCenter = new javax.swing.JLabel();
        lblMsgBottom = new javax.swing.JLabel();

        setForeground(new java.awt.Color(102, 102, 102));
        setLayout(new java.awt.BorderLayout());

        jPanel1.setBackground(java.awt.Color.lightGray);
        jPanel1.setLayout(new java.awt.GridBagLayout());

        lblMsgCenter.setForeground(new java.awt.Color(0, 102, 255));
        lblMsgCenter.setText("Text");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        jPanel1.add(lblMsgCenter, gridBagConstraints);

        lblMsgBottom.setForeground(new java.awt.Color(0, 102, 255));
        lblMsgBottom.setText("Text");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        jPanel1.add(lblMsgBottom, gridBagConstraints);

        add(jPanel1, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel lblMsgBottom;
    private javax.swing.JLabel lblMsgCenter;
    // End of variables declaration//GEN-END:variables

    /**
     * Pass null to remove all info
     * @param song
     */
    public void setInfo(String string) {

        try {
            if (string != null) {
                if (string.length() > 40) {
                    lblMsgCenter.setText(string.substring(0, 40) + "...");
                } else {
                    lblMsgCenter.setText(string);
                }

                //future may add deletes or other messages
                lblMsgBottom.setText("added");
            }
        } catch (NullPointerException npe) {
            //dont give a shit
            npe.printStackTrace();
        }
    }
}
